<?php
/**
 * Remove any default Thematic actions
 * make sure to specify the original priority number
 * 
 * return void
 */
function remove_thematic_actions() {
	remove_action( 'thematic_header', 'thematic_access', 9 );
}
add_action( 'init', 'remove_thematic_actions' );

/**
 * Copied from thematic_access(), we use wp_list_pages() to print the <li> for each page
 * before we put in our Forum entry
 * 
 * return void
 */
function ct_access() {
?>
<div id="access">
	<div class="skip-link"><a href="#content" title="<?php _e( 'Skip navigation to the content', 'thematic' ); ?>"><?php _e( 'Skip to content', 'thematic' ); ?></a></div>
	<div class="menu">
		<ul class="sf-menu">
		    <?php wp_list_pages( 'sort_column=menu_order&title_li=' ); ?>
		    <li class="page_item"><a href="/forum/" title="Forum">Forum</a></li>
	    </ul>
	</div><!-- .menu -->
</div><!-- #access -->
<?php 
}
// Add our ct_access function to the thematic_header hook
add_action( 'thematic_header', 'ct_access' );

function child_head() {
?>
	<script type="text/javascript" src="<?php bloginfo( 'stylesheet_directory' ); ?>/js/jquery.livetwitter.js"></script> 
<?php 
}
add_action( 'wp_head', 'child_head' );

function flickr_feed( $tags ) {
	$apiurl = 'http://api.flickr.com/services/feeds/photos_public.gne?format=php_serial&tags=' . $tags;
	$request = new WP_Http();
	$data = $request->request( $apiurl );
	if ( is_wp_error( $data ) ) {
		//echo "Error:\n" . $data->get_error_message() . "\n";
		return;
	}
	
	$body = unserialize( $data['body'] );
	if ( empty( $body['items'] ) )
		return;
	foreach ( $body['items'] as $item ) {
		$url = $item['url'];
		$m_url = $item['m_url'];
		echo '<a href="' . $url . '"><img src="' . $m_url . '" /></a>' . "\n";
	}
}
